﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Text;
using FoodRaidersWebAPI.Service;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace FoodRaidersWebAPI.Controllers
{
    [ApiController]
    [Consumes("application/json", "multipart/form-data")]
    [Route("[controller]/api")]
    public class FileUploadController : Controller
    {
        [HttpPost]
        public List<String> PostFile([FromForm] IFormCollection formCollection)
        {
            FormFileCollection fileCollection = (FormFileCollection)formCollection.Files;
            List<String> list = new List<string>();
            foreach (IFormFile file in fileCollection)
            {
                list.Add(FileUpload.Upload(file));
            }
            return list;
        }
    }
}